Add nub to recognised package managers#14595
Conversation
Add a NubPackageManager descriptor so projects with a nub.lock lock file are detected as nub-managed.
🦋 Changeset detectedLatest commit: 1e4f3db The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
Per REVIEW.md, changesets target users rather than maintainers and should avoid naming internal constructs. Drops the `NubPackageManager` descriptor reference flagged in review.
Adding one entry to the recognised-package-manager list is additive, same scale as the D1-bindings validation changeset (cloudflare#14530), not a headline feature on the order of cloudflare#14474 (cache options for WorkerEntrypoint exports) — patch fits workers-utils' own convention better than minor.
| @@ -0,0 +1,7 @@ | |||
| --- | |||
| "@cloudflare/workers-utils": patch | |||
There was a problem hiding this comment.
🟡 Changeset incorrectly classified as patch instead of minor for a new feature
The new package manager support is classified as a patch release (.changeset/nub-package-manager.md:2) instead of minor, even though it adds a new public export and extends the type union.
Impact: The release version number will not correctly signal to consumers that new API surface was added.
REVIEW.md semver classification rule violation
REVIEW.md explicitly states that "new API capabilities or exports" and "behavior changes that add functionality" should be classified as minor. This PR adds NubPackageManager as a new export from @cloudflare/workers-utils (packages/workers-utils/src/index.ts:153) and extends the PackageManager type union with "nub" (packages/workers-utils/src/package-manager.ts:7). Both of these are new API capabilities.
REVIEW.md also notes: "The description text matters less than the actual change. A changeset described as 'Support X' is adding a new feature (minor)." The changeset description "Add nub to the list of recognised package managers" is clearly adding support for something new.
| "@cloudflare/workers-utils": patch | |
| "@cloudflare/workers-utils": minor |
Was this helpful? React with 👍 or 👎 to provide feedback.
| export const NubPackageManager = { | ||
| type: "nub", | ||
| npx: "nubx", | ||
| dlx: ["nubx"], | ||
| lockFiles: ["nub.lock"], | ||
| } as const satisfies PackageManager; |
There was a problem hiding this comment.
🔍 Downstream package manager detection logic does not handle nub
The PR adds NubPackageManager as a data constant and export, but none of the downstream detection/resolution code has been updated to recognize nub:
- Wrangler's
getPackageManager()(packages/wrangler/src/package-manager.ts:23-68) checks for npm, yarn, pnpm, and bun only — nosupportsNub()check, no user-agent sniffing for nub. - Wrangler's
sniffUserAgent()(packages/wrangler/src/package-manager.ts:114) returns"npm" | "pnpm" | "yarn" | "bun" | undefined— no"nub"variant. - Autoconfig's
convertDetectedPackageManager()(packages/autoconfig/src/details/framework-detection.ts:150-168) switches on pnpm/yarn/bun/npm with a default fallback to npm — nub would silently fall back to npm. - Create-cloudflare's
detectPackageManager()(packages/create-cloudflare/src/helpers/packageManagers.ts:34-87) similarly has no nub case.
This may be intentional if the PR is a first step (adding the constant so consumers can reference it), but if the goal is full nub support, these detection paths need updating. The changeset description says "Projects using nub can now be automatically detected by their nub.lock file" which implies detection should work, but the only detection shown is in the test's local findByLockFile helper — not in any shipped code.
Was this helpful? React with 👍 or 👎 to provide feedback.
Sorry for the turnover here. Nub has now added its own
nub.locklockfile (was previously piggybacking on other lockfiles) so best practices for detection have changed. Thanks!Adds a
NubPackageManagerdescriptor to@cloudflare/workers-utilsso projects managed by nub are recognised.nub is a package manager with a pnpm-compatible CLI. Its lock file is
nub.lock(pnpm-v9 lockfile format). The new descriptor lets lock-file-based detection identify a nub-managed project, alongside the existing npm/pnpm/yarn/bun entries.The change is additive:
NubPackageManagerinpackages/workers-utils/src/package-manager.ts, mirroring thebundescriptor's shape (npx: "nubx",dlx: ["nubx"],lockFiles: ["nub.lock"]), with"nub"added to thePackageManager["type"]union.index.ts.Scoped to
@cloudflare/workers-utilsonly.